<!DOCTYPE html>
<html lang="en" dir="ltr">

<head>
    <meta charset="utf-8">
    <title>数据查询</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>
    <div class="mainbox">
        <div>
            <input type="text" name="tex" id="tex" class="a-input" placeholder="请输入信息">
            <button class="btn" id="now">立即查询</button>
        </div>
        <div class="ihead"><span>查询结果</span></div>
        <div class="ibody">
            <div> <span>语文:</span><span class="red">00分</span></div>
            <div><span>数学:</span><span>00分</span></div>
            <div><span>英语:</span><span>00分</span></div>
            <div><span>生物:</span><span>00分</span></div>
            <div><span>历史:</span><span class="green">00分</span></div>
            <div><span>物理:</span><span class="green">00分</span></div>
            <div><span>道法:</span><span class="green">00分</span></div>
            <div><span>总分数:</span><span class="green">00分</span></div>
            <div><span>查询时间:</span><span class="green">2024-01-01 12:00:00</span></div>
            <div class="empty"></div>
        </div>
    </div>
</body>
<style type="text/css">
    .mainbox{
        max-width: 600px;
        margin: auto;
    }

    .a-input {
        display: block;
        width: 96%;
        padding-left: 10px;
        height: 38px;
        line-height: 1.3;
        border: 2px solid #ccccc9;
        background-color: #fff;
        color: rgba(1, 5, 2, 0.85);
        border-radius: 2px;
    }

    .btn {
        display: inline-block;
        vertical-align: middle;
        height: 38px;
        line-height: 38px;
        border: 1px solid transparent;
        padding: 0 18px;
        background-color: #16baaa;
        color: #fff;
        white-space: nowrap;
        text-align: center;
        font-size: 14px;
        border-radius: 2px;
        cursor: pointer;
        margin-top: 6px;
        margin-right: 10px;
        margin-bottom: 10px;
        word-spacing: normal;
        width: 100%;
    }
    .ihead {
        text-align: center;
    }

    .ihead span:first-child {
        font-size: 28px;
        font-weight: bold;
        color: #864295;
    }

    .ihead span:nth-child(2) {
        font-size: 20px;
        font-weight: bold;
    }

    .ibody {
        margin-top: 20px;
        padding-left: 8px;
        padding-right: 4px;
        line-height: 34px;
    }

    .ibody div {
        border-bottom: 1px dashed #919199;
    }

    .ibody div span:first-child {
        margin-left: 10px;
    }

    .ibody div span:nth-child(2) {
        color: #00f;
        float: right;
        margin-right: 10px;
    }

    .ibody div.empty {
        height: 5px;
    }

    .blue {
        color: #00f;
    }

    .red {
        color: #e60c03 !important;
    }

    .green {
        color: #277e2d !important;
    }
</style>
<script src="https://mirror.fe80.cn/jquery/3.6.1/jquery.min.js"></script>
<script>
$(function(){
    $('#now').on('click',function(){
        console.log('点击了');
        var card = $("#tex").val().trim();
        if(card.length == 18){
            console.log('身份证输入正确');
            $.post('https://i.fe80.cn/portal/dun/scores.html',{card:card},function(res){
                console.log(res);
                $(".ibody").empty();
                $.each(res.column,function(index,item){
                    console.log(item);
                    $(".ibody").append("<div><span>"+item.name+":</span><span>"+item.value+"</span></div>")
                });
                $(".ibody").append("<div class=\"empty\"></div>");
            });
        }else{
            console.log('身份证输入错误'+card);
        }
    })
})
</script>
</html>